//author: create by SunJH
//时间: 2021/12/15 0015
//邮箱: 965989158@qq.com
//描述: 极光统计的控制器

import 'package:get/get.dart';
import 'package:janalytics/janalytics.dart';

class JgCountController extends GetxController{
  var janalytics = Janalytics();
  var countId = "SunJH";
  var extMap = {"name":"SunJH"};
  var loginExtMap = {"name":"SunJH","login":"登录的ext"};
  var registerExtMap = {"name":"SunJH","register":"注册的ext"};
  var calculateExtMap = {"name":"SunJH","Calculate":"测试数据"};
  var browseExtMap = {"name":"SunJH","browse":"浏览数据"};
  var purchaseExtMap = {"name":"SunJH","browse":"购物数据"};
  var countNum = 0.0;

  countEvent(){
    janalytics.onCountEvent(countId,extMap: extMap);
  }
  calculate(){
    janalytics.onCalculateEvent(countId, countNum,extMap: calculateExtMap);
    countNum++;
  }
  loginEvent(){
    janalytics.onLoginEvent("loginType", true,extMap: loginExtMap);
  }
  register(){
    janalytics.onRegisterEvent("registerType", true,extMap: registerExtMap);
  }
  browse(){
    janalytics.onBrowseEvent("browseId", "商品浏览", "browseType", 30,extMap:browseExtMap );
  }
  purchase(){
    janalytics.onPurchaseEvent("purchaseGoodsid", "苹果", 12,true,Currency.CNY, "food", 12,extMap: purchaseExtMap);
  }
}